package wrap

import (
	"excel-handle/util"
	"fmt"
	"testing"
	"time"
)

func TestTime(t *testing.T) {
	now := time.Now()

	nowStr := now.String()
	println(nowStr)

	year := now.Year()
	println(year)
	println(util.IsLeapYear(year))

	// 本年的第几天
	println(now.YearDay())
	// 月份多少天
	println(util.DaysInMonth(year, time.February))
	println(util.DaysInMonth(2023, time.February))

	println(now.Format(time.RFC850))

}

var SimpleDateLayout string = "2006-01-02"

func TestDateFormat(t *testing.T) {
	now := time.Now()

	// 把time按指定格式转换为字符串
	println(now.Format(SimpleDateLayout))

	// 按指定格式解析日期时间字符串
	time.Parse(SimpleDateLayout, "2023-01-01")

	weekday := now.Weekday()
	fmt.Println(weekday)

	println(weekday == time.Monday)

	println(now.Weekday().String())
	weekdayInt := int(time.Sunday)
	println(weekdayInt)

}
